package de.zainodis.commons.component;

import java.util.Iterator;

/**
 * An entity owns {@link IComponent} or rather: is comprised of them.
 * 
 * @author fzarrai
 * 
 */
public interface IEntity {

   /**
    * @param component
    *           adds the given component.
    */
   void addComponent(Component component);

   /**
    * @param component
    *           removes the given component type.
    */
   void removeComponent(Component component);

   /**
    * Removes all components.
    */
   void clearComponents();

   /**
    * @param requested
    *           the component type to retrieve.
    * @return a {@link Component} of the given type; or null if no match was
    *         found.
    */
   <T extends Component> T getComponent(Class<T> requested);

   /**
    * @return an iterator over all owned components.
    */
   Iterator<Component> getComponents();
}
